@section('title')
    微信登录 @parent
@show @section('content')
    <div style="text-align: center;line-height: 500px;font-size:30px;">正在跳转。。。请稍后。。。</div>
    <script type="text/javascript">
        var union_id = "{{$data['union_id']}}";
        var platform = "{{$data['platform']}}"
        var jumpUrl = "{{ Config::get('app.url') }}";
        var wx_json_url = jumpUrl + "/check/user";
        $.post(wx_json_url, {"union_id": union_id, "platform": platform}, function (data) {
        }, "json").error(function (data) {
        }).success(function (data) {
            if (data.status_code == 400) {
                localStorage.setItem("union_id", JSON.stringify(union_id));
                localStorage.setItem("platform", JSON.stringify(platform));
                window.location.href = jumpUrl + "/bind_phone";
            }else {
                var token = data.token;
                var post_id = JSON.parse(localStorage.getItem('post_id'));
                localStorage.setItem("token", JSON.stringify(token));
                // 判断是否律师入口进的登录
                var entrance = sessionStorage.getItem("entrance");
                if (entrance == "entrance") {
                    if (data.data.status == 1) {
                        location.href = jumpUrl + "/center/become_lawyer";
                    } else if (data.data.status == 3) {
                        location.href = jumpUrl + "/center/lawyer/main";
                    } else {
                        location.href = jumpUrl;
                    }
                    sessionStorage.removeItem("entrance");
                    return false;
                }

                if (post_id != null) {
                    var post_id_status = true;
                    localStorage.setItem("post_id_status", JSON.stringify(post_id_status));
                }
                var goback = sessionStorage.getItem("goback");
                if (goback == null || goback == "" || goback == "undefined") {
                    location.href = jumpUrl;
                } else {
                    location.href = goback;
                }
                sessionStorage.removeItem("goback");
            }
        });
    </script>
    {{ HTML::script('js/index/bind_phone.js') }}
@stop
